/**
 * @作者:黎谢之
 * @创建时间：2021/7/20
 * @修改时间：2021/7/20
 */
package com.example.senior_bug.controller;

import com.example.senior_bug.ToolClass.Result;
import com.example.senior_bug.EntityClass.SKUMessage;
import com.example.senior_bug.Service.AdministratorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/Admin")
public class AdministratorController {
    @Autowired
    private AdministratorService administratorService;

    //管理员登录
    @RequestMapping("/Login")
    public Result Verification(@RequestParam String account, @RequestParam String password) {
        return administratorService.Verification(account, password);
    }

    //管理员页面获取所有商品
    @RequestMapping("/GetAllSku")
    public Result GetAllSku() {
        return administratorService.GetAllSKU();
    }

    //管理员页面审核
    @RequestMapping("/GetAllReviewedSku")
    public Result GetAllReviewedSku() {
        return administratorService.GetAllReviewedSku();
    }

    //管理员修改商品状态发送信息
    @RequestMapping(value = "/SendMessage", method = RequestMethod.POST, produces = "application/json")
    public Result SendMessage(@RequestBody SKUMessage skuMessage) {
        return administratorService.SendMessage(skuMessage);
    }

    //管理员修改商品状态
    @RequestMapping("/ModifyState")
    public Result ModifyState(@RequestParam String NewState, @RequestParam int SkuId) {
        return administratorService.ModifySkuState(NewState, SkuId);
    }

    //管理员添加新分类
    @RequestMapping("/addNewChannel")
    public Result AddNewChannel(@RequestParam String ChannelName) {
        return administratorService.AddNewChannel(ChannelName);
    }

    //管理员添加新二级分类
    @RequestMapping("/addNewCategory")
    public Result AddNewCategory(@RequestParam String CategoryName, @RequestParam String ChannelName) {
        return administratorService.AddNewCategory(CategoryName, ChannelName);
    }

    //管理员添加品牌
    @RequestMapping("/addNewBrand")
    public Result AddNewBrand(@RequestParam String BrandName, @RequestParam String CategoryName) {
        return administratorService.AddNewBrand(BrandName, CategoryName);
    }

    //管理员添加Good
    @RequestMapping("/addNewGood")
    public Result AddNewGood(@RequestParam String GoodName, @RequestParam String BrandName) {
        return administratorService.AddNewGood(GoodName, BrandName);
    }


}
